<!DOCTYPE html>
<html>
<head>
<Title>TBA Activity Registration || Admin Page</Title>
	<!-- css3 formak, style-ok a designhoz, kinezethez-->
    <script src="libraries/jquery.min.js" ></script>
	<link href="Design.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" href="css/stat.css" type="text/css" media="screen" />
	<link href="style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript">
		function errorfind(){<!--parameterbol kiolvassuk hogy van-e hiba ha hiba jelentkezik jelentjuk javascript alert ablakkal-->
			var tmp = decodeURI(<!-- adott hibakodhoz tartozo uzenetet-->
				(RegExp("error" + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
			);
			if (tmp == "true1")
				alert("Activity already exist!");
			if (tmp == "false1")
				alert("Activity inserted succesfully!");
			if (tmp == "true2")
				alert("Please write the activity name!");
			if (tmp == "true3")
				alert("Activity delete failed!");
			if (tmp == "false2")
				alert("Activity delete succesfully!")
		}
		<!--atvesszuk a php-tol az altala lekert adatokat az adatbazisbol javascriptbe-->
		var activity = [<?php include "classes.php"; $pclass = new activitys; $pclass->getactivitylistdb($nma,$ida);echo "$nma";?>];
		var activityID = [<?php echo "$ida";?>];
		function populateList() {<!--feltoltjuk a select reszt az activity-k listajaval-->
			var listLen=activity.length;
			for(var i=0; i<listLen; i++){<!--vegigmegyunk az activityk javascriptes listajan es feltoltjuk a select reszt-->
				document.activityform.activity.options[i]=new Option(activity[i], activityID[i]);
			}
			errorfind();<!--select feltoltese utan megnezzuk a hibakat majd megjelenitjuk az oldalt-->
		}
		<!--mikor megjelenik az oldal feltoltjuk elsonek a selectet majd kiirjuk a hibakat es azutan betoltodik az oldal-->
		window.onload=populateList;
	</script>
</head>
<body style="background-color:#69F;">
	<br><div id="title" style="background-color:#69F;">Edit Activities</div><br>
	<table id="manager">
		<td id="managerbuttons" style="vertical-align:text-top;">
		<!--az adminnak a funkcioihoz a gombok amelyek atiranyitjak az adott funciokhoz
			projekt statisztikak-->
			<a href="projects.php?pid=1"><button id="button" width="50">Projects</button></a><br>
			<!-- alkalmazottak statisztikaja-->
			<a href="people.php?aid=Alt.Attila5"><button id="button" width="50">Employments</button></a><br>
			<!-- activityk kezelese-->
			<a href="activityedit.php"><button id="button" width="50">Edit Activities</button></a><br>
			<!-- altalanos statisztika -->
			<a href="stat.php"><button id="button" style="width:50">Statistics</button></a><br>
			<!-- admin jog kiosztasa-->
			<a href="usersettings.php"><button id="button" style="width:50">Edit Users</button></a><br>
			<!-- admin feluletrol kijelentkezes-->
			<a href="BLL.php?logout="><button id="button" style="width:50">Logout</button></a><br>
		</td>
		<td id="managerinfo" style="background-color:#69F;">
		<br><br>
		<div id="subtitle">
			<form name="activityform" action="BLL.php"> 	
			<!--Ha akarunk torolni egy aktivitast kivalassztjuk a lenti listabol-->
				Select activity to delete
				<select name="activity">
				</select>
				<!-- Torlesi megerositesi gomb a torleshez-->
				<input id="button" type="submit" name="deleteactivity" value="Delete activity!">
			</form><br><br>
			<form action="BLL.php">
			<!--Beszurando activity nevenek a fieldje-->
				Type the new activity name:
				<input type="text" size="25" name="activity" required />
				<!--megerosites az activity beszurasahoz-->
				<input type="submit" id="button" name="activityinsert" value="Insert in activities list!"/></div>
			</form>
		</td>
	</table>
</body>
</html>